package com.example.shop_2305.adapter

import android.graphics.Paint
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.lib_base.entity.Goods
import com.example.shop_2305.R
import com.example.shop_2305.utils.GlideUtils

class GoodsAdapter:BaseQuickAdapter<Goods,BaseViewHolder>(R.layout.item_goods) {
    override fun convert(holder: BaseViewHolder, item: Goods) {
       GlideUtils.loadCorner(context,item.image,holder.getView(R.id.goods_image),20)
        holder.setText(R.id.goods_name,item.storeName)
        holder.setText(R.id.goods_price,"￥${item.price}")
        holder.setText(R.id.goods_otprice,"￥${item.otPrice}")
        holder.setText(R.id.goods_sale,"已售${item.sales+item.ficti}件")//销量为  销量+虚拟销量  字段类型改为Int

        holder.getView<TextView>(R.id.goods_otprice).paintFlags = Paint.STRIKE_THRU_TEXT_FLAG//设置中划线删除线
    }
}